<!DOCTYPE html>
<!-- saved from url=(0147)file:///C:/Users/web/Desktop/1904%E5%88%98%E5%B9%BC%E5%BE%B7/%E5%BC%80%E8%AF%BE%E5%95%A6/%E7%AC%94%E8%AE%B0/JS%E9%AB%98%E7%BA%A7/day02/6regexp.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var kwords=["青天","白鹭","河图","紫烟"];
     var str=kwords.join("|");
     var msg=prompt("请输入消息");
     var reg=new RegExp(str);
     var i=msg.search(reg);
    if(i!=-1){
        document.write(`<h1>包含敏感词</h1>`)
    }else{
        document.write(`<h1>发送成功</h1>`)
    }
    </script><h1>包含敏感词</h1></body></html>